package com.hanggold.jfinal.directive;

import com.jfinal.template.Directive;
import com.jfinal.template.Env;
import com.jfinal.template.expr.ast.ExprList;
import com.jfinal.template.io.Writer;
import com.jfinal.template.stat.Scope;

import java.io.IOException;

/**
 * TODO COMMENT.
 *
 * @author <a href="mailto:sunmch@163.com">smc</a>
 * @date 2021-06-25 08:20
 * @since 1.0.0
 **/
public class MyDirective extends Directive {
    
    @Override
    public void setExprList(final ExprList exprList) {
        super.setExprList(exprList);
    }
    
    @Override
    public void exec(final Env env, final Scope scope, final Writer writer) {
        try {
            writer.write("myCustomTemplate<br>");
            stat.exec(env,scope,writer);
            writer.write("myCustomTemplate--end<br>");
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    
    @Override
    public boolean hasEnd() {
        return true;
    }
}
